var t = require;
var e = module;
var o = exports;
var i, n = this && this.__extends || (i = function(t, e) {
    return (i = Object.setPrototypeOf || {
        __proto__: []
    }
    instanceof Array &&
    function(t, e) {
        t.__proto__ = e
    } ||
    function(t, e) {
        for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o])
    })(t, e)
},
function(t, e) {
    function o() {
        this.constructor = t
    }
    i(t, e),
    t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o)
}),
a = this && this.__decorate ||
function(t, e, o, i) {
    var n, a = arguments.length,
    r = a < 3 ? e: null === i ? i = Object.getOwnPropertyDescriptor(e, o) : i;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, i);
    else for (var s = t.length - 1; s >= 0; s--)(n = t[s]) && (r = (a < 3 ? n(r) : a > 3 ? n(e, o, r) : n(e, o)) || r);
    return a > 3 && r && Object.defineProperty(e, o, r),
    r
};
Object.defineProperty(o, "__esModule", {
    value: !0
});
var r = t("GameConstant"),
s = t("Util"),
l = t("Global"),
c = t("MineTrigger"),
d = cc._decorator,
h = d.ccclass,
p = d.property,
u = function(t) {
    function e() {
        var e = null !== t && t.apply(this, arguments) || this;
        return e.pfb_mine = null,
        e.node_respown = null,
        e._gameControl = null,
        e._nCarSite = 0,
        e._carTag = 0,
        e.nUseTime = 0,
        e.mines_arr = new Array,
        e.bCanAttack = !0,
        e.isPlace = !0,
        e.preCarPos = null,
        e
    }
    return n(e, t),
    e.prototype.init = function(t, e, o, i) {
        this._gameControl = t,
        this._nCarSite = e,
        o == r.Collide_Car_Tag.Left ? (this.node.scaleX = 1, this.node.position = i) : (this.node.scaleX = -1, this.node.position = cc.v3( - i.x, i.y, i.z))
    },
    e.prototype.onGameStart = function() {},
    e.prototype.onGameOver = function() {},
    e.prototype.onGameBoutStart = function() {
        var t = this;
        this.bCanAttack = !0,
        r.Cur_Game_Type == r.Game_Type.Auto && this.scheduleOnce(function() {
            t.onUseTools()
        },
        1)
    },
    e.prototype.onGameBoutOver = function() {
        for (var t = 0; t < this.mines_arr.length; t++) {
            var e = this.mines_arr[t];
            s.Util.objectPool.putNodeIntoNodePool(l.PoolKey.mine, e)
        }
        this.mines_arr = []
    },
    e.prototype.onCanAttack = function(t) {
        this.bCanAttack = t
    },
    e.prototype.onUseTools = function(t) {
        var e = this;
        t ? this.isPlace && (this.isPlace = !1, this.respoenMine(), this.scheduleOnce(function() {
            e.isPlace = !0
        },
        3)) : this.respoenMine()
    },
    e.prototype.respoenMine = function() {
        var t = this.node_respown.convertToWorldSpaceAR(cc.Vec3.ZERO),
        e = this._gameControl.container.convertToNodeSpaceAR(t),
        o = s.Util.objectPool.getNodeFromNodePool(l.PoolKey.mine, this.pfb_mine);
        o.position = e,
        this._gameControl.container.addChild(o),
        o.getChildByName("collier").getComponent(c.default).init(this._gameControl),
        this.mines_arr.push(o)
    },
    e.prototype.onCancelUse = function() {},
    e.prototype.isAIUseToos = function() {
        this._gameControl._carRightView.getCarWorldPos()
    },
    a([p(cc.Prefab)], e.prototype, "pfb_mine", void 0),
    a([p(cc.Node)], e.prototype, "node_respown", void 0),
    a([h], e)
} (cc.Component);
o.default = u